Skip to main content
Version: 5.0.x {nightly}

CAN bus message creation

This is a description of how to create a CAN message for driver and common block API.

CAN ID

By default, 3 bites of CAN ID are reserved for the Sender address. Other bits are for SID (Service ID).

note

With 3 bites for the address, there are maximum 8 devices o the CAN bus.
This can be changed, there are this possible solutions:

  • It can be hardcoded in OEM FW
  • It can be changed by command msgconf 3 4 0 n
    - Where `n` is bit count for sender address (more in yOS documentation)
BitDescription
0Sender addr bit 0
1Sender addr bit 1
2Sender addr bit 2
3SID bit 0
4SID bit 1
5SID bit 2
...
Last bit 10 or 28Standard or extended CAN
info

Sender address is usually 7, or any unused address.

CAN ID example

Sending message with SID 24 from address 7.
CAN ID = (24 << 3) + 7 = 192 + 7 = 199 (DEC) = 0xC7 (HEX)

CAN message data for unicast

Unicast (datagram contains receiver and sender address)

ByteDescription
0Receiver address
1Payload byte 0
2Payload byte 1
3Payload byte 2
4Payload byte 3
5Payload byte 4
6Payload byte 5
7Payload byte 6

CAN message data for multicast

Multicast (datagram contains sender address only)

ByteDescription
0Payload byte 0
1Payload byte 1
2Payload byte 2
3Payload byte 3
4Payload byte 4
5Payload byte 5
6Payload byte 6
7Payload byte 7